<?php
class Util {
	
	/**
	 * 调用gravatar头像
	 *
	 * @param unknown_type $email
	 * @param unknown_type $size
	 * @param unknown_type $rating
	 * @return unknown
	 */
	public static function avatar($email, $size = 32, $rating = 'G', $default = '/images/avatar.gif') {
		$grav_rating = array("G", "PG", "R", "X");
		!in_array($rating, $grav_rating) && $rating = 'G';
		$grav_url = "http://www.gravatar.com/avatar.php?gravatar_id=".md5($email)."&amp;raging={$rating}&amp;default=".urlencode($default)."&amp;size={$size}";
		return "<img src=\"{$grav_url}\" width=\"{$size}\" class=\"avatar\" alt=\"avatar\" />";
	}
	
}